﻿using AutoMapper;
using Finance.Api.Write.Applications.Commands.财务管理.Receives;
using Finance.Api.Write.Applications.Commands.财务管理.Refunds;
using Finance.Api.Write.Applications.Commands.财务管理.ReturnMonerys;
using Finance.Api.Write.Applications.Commands.库存盘点;
using Finance.Api.Write.Applications.Commands.库存调拨;
using Finance.Api.Write.Applications.Commands.入库管理;
using Finance.Api.Write.Applications.Commands.出库管理;
using Finance.Api.Write.Applications.Commands.调拨入库管理;
using Finance.Api.Write.Applications.Commands.调拨出库管理;
using Finance.Domain;
using Finance.Domain.盘点;
using Finance.Domain.调拨;

namespace Finance.Api.Write
{
    public class MappingProfile:Profile
    {

        public MappingProfile() {
            CreateMap<Receive, ReceiveAddCommand>().ReverseMap();
            CreateMap<Receive, ReceiveUpdataCommand>().ReverseMap();
            CreateMap<Receive, ReceiveDelLoginCommand>().ReverseMap();
            CreateMap<Refund, RefundAddCommand>().ReverseMap();
            CreateMap<Refund, RefundUpdataCommand>().ReverseMap();
            CreateMap<Refund, RefundDelCommand>().ReverseMap();

            CreateMap<ReturnMoney, AddReturnMoneryCommand>().ReverseMap();
            CreateMap<ReturnMoney,UpdateReturnMoneryCommand>().ReverseMap();

            // 库存盘点映射配置
            CreateMap<CheckModel, CheckAddCommand>().ReverseMap();
            CreateMap<CheckModel, CheckUpdateCommand>().ReverseMap();
            CreateMap<CheckModel, CheckDeleteCommand>().ReverseMap();

            // 入库管理映射配置
            CreateMap<GoinAddCommand, GoinBox>();
            CreateMap<GoinDetail, GoinDetail>().ForMember(dest => dest.checkid, opt => opt.MapFrom(src => src.checkid));

            // 出库管理映射配置
            CreateMap<OutAddCommand, OutBox>();
            CreateMap<OutDetail, OutDetail>().ForMember(dest => dest.checkid, opt => opt.MapFrom(src => src.checkid));

            // 库存调拨映射配置
            CreateMap<DeploymentModel, DeploymentAddCommand>().ReverseMap();
            CreateMap<DeploymentDetail, DeploymentDetail>().ForMember(dest => dest.Deploymentid, opt => opt.MapFrom(src => src.Deploymentid));

            // 调拨入库映射配置
            CreateMap<DeployGoinAddCommand, DeployGoin>();
            CreateMap<DeployGoinDetail, DeployGoinDetail>();

            // 调拨出库映射配置
            CreateMap<DeployOutAddCommand, DeployOut>();
            CreateMap<DeployOutDetail, DeployOutDetail>();
        }

    }
}
